package com.raymond.smgp.handler;

import com.alibaba.fastjson.JSONObject;
import com.raymond.client.handler.BaseHandler;
import com.raymond.smgp.msg.request.ActiveTestRequestMessage;
import com.raymond.smgp.msg.response.ActiveTestResponseMessage;
import io.netty.channel.ChannelHandlerContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 状态报告和上行业务处理
 *
 * @author :  raymond
 * @version :  V1.0
 * @date :  2021-08-06 11:45
 */
public class ActiveTestRequestMessageHandler extends BaseHandler<ActiveTestRequestMessage> {
    private final static Logger logger = LoggerFactory.getLogger(ActiveTestRequestMessageHandler.class);

    @Override
    protected void channelRead(ChannelHandlerContext ctx, ActiveTestRequestMessage msg) throws Exception {
        logger.debug("收到心跳:{}", JSONObject.toJSONString(msg));
        ctx.writeAndFlush(new ActiveTestResponseMessage(msg.getSequenceId()));
    }
}
